<template>
  <div class="radio">
    <input
      :value="value"
      @input="$emit('update:modelValue', value)"
      type="radio"
      :id="id"
      :name="name"
    />
    <label
      :for="id"
      :style="{ color: color, backgroundColor: backgroundColor }"
      >{{ info }}</label
    >
  </div>
</template>

<script lang="ts" setup>
import { defineProps } from "vue";
defineProps({
  id: {
    type: String,
    required: true,
  },
  info: {
    type: String,
    required: true,
  },
  name: {
    type: String,
    required: true,
  },
  color: {
    type: String,
    default: "black",
  },
  backgroundColor: {
    type: String,
    default: "white",
  },
  value: {
    type: Boolean,
  },
});
</script>

<style lang="scss" scoped>
$colors: (
  "t-blue": #21618d,
  //常用颜色--蓝
  "t-grey": #8a8888,
  //字体常用颜色--灰
  "t-white": #f5f5f5,
  //字体常用颜色--白
  "border": #707070 //边框颜色,
);
.radio {
  width: 150px;
  height: 40px;
  border: 1px solid map-get($map: $colors, $key: border);
  input {
    display: none;
  }
  input:checked + label {
    box-shadow: 5px 5px 5px 5px map-get($map: $colors, $key: border);
  }
  label {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
    text-align: center;
    font-size: 25px;
    font-weight: bold;
    transition: all 0.5s;
  }
}
</style>